<admintpl file="header" />
<style>
    .wrap{
        margin:10px;
    }
</style>

</head>
<body>
<div class="wrap">
    <div class="row">
        <div class="col-xs-12">
            <!-- 返回信息 -->
            <div class="error-message" style="display:none;"></div>
            <form id="backupForm" action="{:U('Admin/DataBase/index_post',array('type'=>$btype,'backup_name'=>$bname,'sizelimit'=>$bsizelimit,'dosubmit'=>$bdosubmit))}" method="post">
                <div>
                    <a href="{:U('Admin/DataBase/restore')}" class="btn btn-defalut">查看备份</a>
                    <!-- <input type="submit" value="开始备份" class="btn btn-info" id="submitbtn"> -->
                    <input type="button" value="开始备份" class="btn btn-info" id="submitbtn">
                </div>
                <div class="widget-box">
                    <div class="widget-header widget-header-flat">
                        <h4 class="smaller">
                            <i class="ace-icon glyphicon glyphicon-list"></i>
                            {$meta_title}
                        </h4>
                    </div>
                    <div class="widget-body">
                        <div class="widget-main">
                            <!-- 自定内容 -->
                            <div class="table_list">
                                <table class="table" cellspacing="0" class="table_form">
                                    <tr>
                                        <td class="col-xs-2">备份分卷大小(每一份文件的大小)</td>
                                        <td>
                                            <input type="text" name="sizelimit" value="{$sizelimit}" size="10"> K
                                            &nbsp;&nbsp;(推荐200k以下)
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>备份名称</td>
                                        <td><input type="text" name="backup_name" value="{$backup_name}"></td>
                                    </tr>
                                    <tr>
                                        <td>备份类型</td>
                                        <td>
                                            <label>
                                                <input type="radio" checked="checked" value="full" name="backup_type" onclick="javascript:$('#js-showtables').hide();" class="ace">
                                                <span class="lbl"> 备份所有&nbsp;&nbsp;</span>
                                            </label>
                                            <label>
                                                <input type="radio" value="custom" name="backup_type" onclick="javascript:$('#js-showtables').show();" class="ace" />
                                                <span class="lbl">自定义备份</span>
                                            </label>
                                        </td>
                                    </tr>
                                    <tr id="js-showtables">
                                        <td align="right">
                                            <label class="position-relative">
                                                <input type="checkbox" class="ace" checked="checked" id="selectAll" onclick="checkAll()">
                                                <span class="lbl">&nbsp;&nbsp;全选/反选</span>
                                            </label>
                                        </td>
                                        <td colspan="2">
                                            <volist name="tables" id="val">
                                                <label class="position-relative inline" style="width:300px;">
                                                    <input name="backup_tables[{$val}]" type="checkbox" value="-1" checked="checked" class="ace js-checkitem" />
                                                    <span class="lbl">&nbsp;&nbsp;{$val}</span>
                                                </label>
                                            </volist>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                    </tr>
                                </table>
                            </div>
                            <!-- end -->
                        </div>
                    </div>
                </div>
            </form>
            <!-- end -->
        </div>
    </div>
    <!-- /.row -->
</div>
</body>
<style type="text/css">
    #js-showtables{display:none;}
    .checkbox.inline{
        margin-left: 10px;
    }
</style>
<script type="text/javascript" src="__PUBLIC__/Common/js/jquery_asyncoper.js"></script>
<script type="text/javascript">
    // 全选反选
    function checkAll()
    {
        var checkedOfAll=$("#selectAll").prop("checked");
        $("input[type='checkbox']").prop("checked", checkedOfAll);
    }
    $(function(){
        $("#submitbtn").click(function(){
            $('.error-message').css('display','block');
            $('.error-message').html('<div class="alert alert-block alert-success"><button type="button" class="close" data-dismiss="alert"><i class="ace-icon fa fa-times"></i></button><i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i>&nbsp;&nbsp;正在备份，请勿进行其他操作！</div>');
            var data=$('#backupForm').serialize();
            var url="{:U('Admin/DataBase/index_post')}";
            postajaxForm(url,data);
        });
    });
</script>
</html>